Skip to content

fix: add v5 migration to normalize legacy filenames#125

Merged
fank merged 2 commits intomainfrom
fix/normalize-legacy-filenames
Feb 4, 2026
Merged

fix: add v5 migration to normalize legacy filenames#125
fank merged 2 commits intomainfrom
fix/normalize-legacy-filenames

Conversation

@fank
Copy link
Member

@fank fank commented Feb 4, 2026

Summary

  • Add database migration (v5) that strips .json and .json.gz suffixes from filenames at server startup
  • Old database entries stored filenames as missionname.json, causing double extensions (missionname.json.json.gz) when loading or converting missions
  • Migration runs once automatically and is tracked by the version table

Test plan

  • Added TestMigrationV5NormalizeFilenames that creates a pre-v5 database with legacy filenames and verifies they are normalized after migration
  • Updated TestMigrationRerun to expect version 5
  • All existing tests pass

fank added 2 commits February 4, 2026 22:36
Old database entries store filenames as missionname.json which causes
double extensions (missionname.json.json.gz) when loading or converting.
Normalize filenames when reading from the database so all consumers
(handlers, converter, cleanup) get clean base names.
Replace runtime normalizeFilename workaround with a proper database
migration that strips .json and .json.gz suffixes from filenames at
startup. This fixes old database entries that caused double extensions
(missionname.json.json.gz) when loading or converting missions.
@github-actions
Copy link

github-actions bot commented Feb 4, 2026

Merging this branch will decrease overall coverage

Impacted Packages Coverage Δ 🤖
github.com/OCAP2/web/internal/server 44.01% (-0.10%) 👎

Coverage by file

Changed files (no unit tests)

Changed File Coverage Δ Total Covered Missed 🤖
github.com/OCAP2/web/internal/server/operation.go 48.62% (-0.57%) 580 (+27) 282 (+10) 298 (+17) 👎

Please note that the "Total", "Covered", and "Missed" counts above refer to code statements instead of lines of code. The value in brackets refers to the test coverage of that file in the old version of the code.

Changed unit test files

  • github.com/OCAP2/web/internal/server/operation_test.go

@fank fank merged commit cba4e11 into main Feb 4, 2026
2 checks passed
@fank fank deleted the fix/normalize-legacy-filenames branch February 4, 2026 21:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant